<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box1 {
        width: 200px;
        height: 200px;
        background-color: red;
        transition: all 3s; 
        /* 给默认状态设置,鼠标移入移出都有过渡效果 */
    }
    .box1:hover {
        width: 500px;
        height: 500px;
        background:skyblue;
    }

    .box2 {
        width: 200px;
        height: 200px;
        background-color: gold;
    }
    .box2:hover {
        width: 500px;
        height: 500px;
        background:lightgreen;
        transition: all 3s;
        /* 给hover状态设置,鼠标移入有过渡效果,移出会瞬间回归默认状态 */
            /* 因为鼠标移出之后,hover状态的选择器就不能再选择当前的标签了 */
    }
</style>
<body>
    <div class="box1"></div>
    <div class="box2"></div>
</body>
</html>